package com.itheima.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.mapper.CheckitemMapper;
import com.itheima.pojo.Checkitem;
import com.itheima.service.CheckitemService;
import com.itheima.support.PageResult;
import com.itheima.support.QueryPageBean;
import org.apache.dubbo.config.annotation.DubboService;

import java.util.List;

@DubboService
public class CheckitemServiceImpl extends ServiceImpl<CheckitemMapper, Checkitem> implements CheckitemService {
    @Override
    public PageResult findByPage(QueryPageBean queryPageBean) {
        //分页查询
        IPage<Checkitem> result = this.page(new Page<Checkitem>(queryPageBean.getCurrentPage(),queryPageBean.getPageSize()));
        return new PageResult(result.getTotal(),result.getRecords());
    }

    @Override
    public List<Checkitem> findByGroupId(Long groupId) {
        return baseMapper.findByGroupId(groupId);
    }
}
